<#include "layout/template.ftl"/>

<@htmlHead title="商户订单详情">

	<style>
		tr td:first-child,tr th:first-child{
			text-align:center;
		}
	</style>
	
</@htmlHead>


 
<@htmlBody 'order' 'merchantorder'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '商户订单管理' '商户订单详情'></@breadcrumbs>
	<!-- breadcrumbs end -->

	<!-- page-content begin -->
	<div class="page-content">
			
			<!-- page-header begin -->
			<div class="page-header">
					<h1>商户订单详情</h1>
			</div>
			<!-- page-header end -->

			<!-- page-body begin -->
			<div class="row">	
				<div class="col-md-8 col-md-offset-2">

						<!-- form begin  -->
						<form class="form-horizontal" id="validation-form" method="post" action="${path}/manage/order/update/${order.id}" >
							<fieldset>
					
								<input type="hidden" class="form-control" name="id"  id="id"  value="${order.id}"/>
								
								

								<h6>订单产品</h6>
					       		<div>
					       			<table class="table">
					       				<tr>	
											<th width="100">商品编号</th>
											<th>商品图片</th>
											<th>商品名称</th>
											<th>价格</th>
											<th>商品数量</th>
										</tr>
						       			<#list orderItems as item>
											<tr>	
												<td>${item.goods.id}</td>
												<td><img src="${item.goods.picurl}" style="width:50px;height:50px;"></td>
												<td>${item.goods.title}</td>
												<td><strong style="color:red">￥${item.price}<strong></td>
												<td>${item.amount}</td>
											</tr>
										</#list>	
									</table>
								</div>
								
								<div class="hr hr-dotted"></div>
								<h6>订单信息</h6>
								
								<div>
									<table class="table table-bordered">
					       				<tr>	
											<td width="100">订单编号</td>
											<td>${order.orderno}</td>
										</tr>
										<tr>	
											<td>支付方式</td>
											<td>
												
												<#if order.orderPlat.paymenttype==1>	
												     支付宝
												<#else>	
												     微信支付
												</#if>
												
											</td>
										</tr>
										<tr>	
											<td>收货方式</td>
											<td>
												<#if order.orderPlat.consigneetype==1>	
												     快递
												<#else>	
												     自提
												</#if>
											</td>
											
										</tr>
										<tr>	
											<td>支付类型</td>
											<td>
												<#if order.orderPlat.paymode==1>	
												     现金
												<#else>	
												     积分
												</#if>
											</td>
											
										</tr>
										<tr>	
											<td>实际总金额</td>
											<td>
												${order.actualPrice}
											</td>
											
										</tr>
										<tr>	
											<td>实际支付金额</td>
											<td>
												${order.total}
											</td>
										</tr>
										<tr>	
											<td>减免总金额</td>
											<td>
												${order.subPrice}
											</td>
											
										</tr>
										<tr>	
											<td>下单时间</td>
											<td>${order.createTime}</td>
										</tr>
										<tr>	
											<td>订单状态</td>
											<td>
												<#list orderStatusEnum as em>
												<#if order.status==em.value>	
													${em.comment}
												</#if>
												</#list>
											</td>
										</tr>
									</table>
								</div>
									

								<div class="hr hr-dotted"></div>
								<h6>收货人信息</h6>
								<div>
									<table class="table table-bordered">
					       				<tr>	
											<td width="100" >收货人姓名</td>
											<td>${order.receiver}</td>
										</tr>
										<tr>	
											<td>收货人地址</td>
											<td>${order.address}</td>
										</tr>
										<tr>	
											<td>收货人电话</td>
											<td>${order.telephone}</td>
										</tr>
									</table>
								</div>
								
								<div class="hr hr-dotted"></div>
								<h6>配送信息</h6>
								<div>
									<table class="table table-bordered">
					       				<tr>	
											<td width="100" >物流公司</td>
											<td>${order.express.name}</td>
										</tr>
										<tr>	
											<td>物流单号</td>
											<td>${order.expressno}</td>
										</tr>
									</table>
								</div>
								

								
								
								<div class="hr hr-dotted"></div>
								<h6>结算信息</h6>
								<div >
		                        	<p class="text-left">${order.amount}件商品,共计<strong style="color:red">
		                        	<#if order.pttype==1>
		                        	    ${order.total} 积分
		                        	<#else>
		                        	       ￥${order.total}
		                        	</#if>
		                        	<strong> </p>
								</div>
								
							</fieldset>
						</form>
						<!-- form end--> 
						
						
						<form class="form-horizontal" id="validation-form" method="post" action="${path}/manage/order/merchantorder/remarks" >
								<input type="hidden" id="id" name="id"  value="${order.id}">
								<span> 备注  </span>
								 <input type="text" class="form-control" placeholder="请输入备注" name="remarks" id="remarks" value="${order.remarks}"  style="margin-top: 10px;">
					            <button id="form-submit" type="submit" class="btn btn-primary" style="margin-top: 10px;">
									<i class="fa fa-save align-top bigger-125"></i>保存
								</button>
						</form>	 
					
			</div>
			<!-- page-body end -->
		
	</div>		
	<!-- page-content end -->

</@htmlBody>



<@htmlBodyScript>
    
	<!-- 验证框架 -->	
	<script src="${resources}/plugins/jquery-validation/jquery.validate.min.js"></script>
	<script src="${resources}/plugins/jquery-validation/messages_zh.min.js"></script>
	<script type="text/javascript">

			jQuery.validator.addMethod("isName", function(value, element) {       
	 			var corpName =  /^[\u0391-\uFFE5\w\-\s\.]{1,50}$/;
  				 return this.optional(element) || corpName.test(value);       
 			}, "请使用汉字、英文字母、数字、下划线、减号、空格或点");   
 			
	
			$('#validation-form').validate({
				errorElement: 'div',
				errorClass: 'help-block',
				focusInvalid: false,
				rules: {
					name: {
						required:true,
						maxlength: 50,
						isName:true
					},
					title: {
						required:true,
						maxlength: 100
					},
					price: {
						required:true
					},
					total: {
						required:true,
						range:[1,1000000]
					},
					remain: {
						required:true,
						range:[1,1000000]
					},
					paytype: {
						required:true
					},
					cagList: {
						required:true
					},
					"classify.id": {
						required:true
					},
					remark: {
						maxlength: 255
					}
				},
		
				messages: {
				},
		
		
				highlight: function (e) {
					$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
				},
		
				success: function (e) {
					$(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
					$(e).remove();
				},
		
				errorPlacement: function (error, element) {
					if(element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
						var controls = element.closest('div[class*="col-"]');
						if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
						else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
					}
					else if(element.is('.select2')) {
						error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
					}
					else if(element.is('.chosen-select')) {
						error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
					}
					else error.insertAfter(element.parent());
				},
		
				submitHandler: function (form) {
					form.submit();
				},
				invalidHandler: function (form) {
				}
			});
	</script>
</@htmlBodyScript>